import { request, config } from '../utils'
const { api } = config;
const { add, allow, endList, ingList, notreatList, reject, comment,repairDetauls} = api;

//获取待报修列表
export async function queryNotreat(params){
    return request({
        url:notreatList,
        method:'POST',
        data:params
    })
}

//获取正在报修列表
export async function queryIng(params){
    return request({
        url:ingList,
        method:'POST',
        data:params
    })
}

//获取完成报修列表
export async function queryEnd(params){
    return request({
        url:endList,
        method:'POST',
        data:params
    })
}

//普通用户添加报修
export async function addRepair(params) {
    return request({
        url:add,
        method:'POST',
        data:params
    })
}

//操作员同意报修
export async function allowRepair(params){
    return request({
        url: `${allow}/${params}`,
        method:'POST',
        data:params,
    })
}

//操作员拒绝报修，并输入理由
export async function rejectRepair(params){
    return request({
        url: `${reject}/${params.id}?comment=${params.comment}`,
        method: 'POST',
        data: params
    })
}

//操作员输入结果
export async function commentRepair(params){
    return request({
        url: `${comment}/${params.id}?comment=${params.comment}`,
        method: 'POST',
        data:params,
    })
}

//获取详情
export async function queryDetail(params){
    return request({
        url:`${repairDetauls}/${params}`,
        method:'POST',
        data:params,
    })
}